package com.mjf.web.controller.common;

import com.mjf.jst.service.BcCjstSkuService;
import com.mjf.jst.service.BcJstSalesOutTService;
import com.mjf.jst.service.ShopInfoService;
import com.mjf.ys.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * desc
 * </p>
 *
 * @author chenshoumeng
 * @date 2025/6/8 00:51
 */
@RestController
@RequestMapping("/jst/async")
public class JSTAsyncController {

    @Autowired
    private ShopInfoService shopInfoService;
    @Autowired
    private BcJstSalesOutTService jstSalesOutService;
    @Autowired
    private BcCjstSkuService bcCjstSkuService;

    /**
     * 同步店铺
     */
    @GetMapping("/shop")
    public Object asyncShop() {
        shopInfoService.pullShopsList();
        return "success";
    }

    /**
     * 同步销售出库单
     */
    @GetMapping("/salesout")
    public Object asyncSalesout(@RequestParam(required = false) String start,
                                @RequestParam(required = false) String end) {
        jstSalesOutService.asyncSalesout(start, end);
        return "success";
    }

    /**
     * 同步商品
     */
    @GetMapping("/product")
    public Object asyncProduct(@RequestParam(required = false) String start,
                               @RequestParam(required = false) String end) {
        bcCjstSkuService.asyncProduct(start, end);
        return "success";
    }



}
